#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

//bool kvcom(int a, int b)
//{
//	return  a < b;
//}
struct com
{
	bool operator()(int a, int b)
	{
		return  a < b;
	}

	 bool kvcom(int a, int b)
	{
		return  a < b;
	}
};

int main()
{
	int arr[6] = { 1,3,5,8,7,9 };
	vector<int> v(arr,arr+6);
	//sort<vector<int>::iterator,bool(*)(int,int)>(v.begin(), v.end(), com::kvcom);

	//sort<vector<int>::iterator, bool(com::*)(int, int)>(v.begin(), v.end(), &com::kvcom);
	sort(v.begin(), v.end(), &com::kvcom);

	//sort<vector<int>::iterator,com>(v.begin(), v.end(), com());
	//com c;
	
	bool(com::*p) (int, int) = &com::kvcom;
	//p(1, 2);  //wrong
	//c.p(1, 2);  //wrong
	//(c.*p)(1, 2);  //right

	//bool (*p)(int, int) = com::kvcom;
	//p(1, 3);

	for (auto e : v)
		cout << e << " ";
	return 0;
}